import { defineStore } from "pinia";
import { reqPayOrder } from "@/API/APIs/api";
import TypeSum from '@/TypeSum/entry'

interface Datas {
    listData?: any
}

export const useCenterStore = defineStore("CenterStore", {
    state: (): Datas => ({
        listData: {}
    }),
    actions: {
        async getPayOrderData(pages: number, limit: number) {
            const result = await reqPayOrder(pages, limit) as TypeSum['AxiosData']['AxiosData']
            if (result.code == 200) {
                this.listData = result.data
            }
        }
    },
    getters: {
        records(state) {
            return state.listData ? state.listData.records : [];
        }
    }
})